<h4>Add Source by External URL</h4>
<form id="add-source-by-url">

    <label for="add-source-by-url-url">URL:</label><br />
    <input type="text" id="add-source-by-url-url"
           style="width: 99%;"/>

    <label for="add-source-by-url-codec">Codec:</label><br />
    <select id="add-source-by-url-codec">
        <?php foreach ($codecTypes as $codec => $value): ?>
            <option value='<?php echo $value ?>'><?php echo $codec ?></option>
        <?php endforeach; ?>
    </select>

    <p style="float: right;">
        <input type="submit"
               value="Submit Source" />
    </p>
    <div class="clear" ></div>
</form>

<script type="text/javascript">
    var av_current_count;
    var html5av_api = '<?php echo html5av_manager::getApiURL() ?>';
    
    jQuery(function($) {
        $('#add-source-by-url').submit(function() {
            if($('#add-source-by-url-url').val() != '') {
                var url = $('#add-source-by-url-url').val();
                var type = $('#add-source-by-url-codec').val();
                var post = {
                    action: 'html5av_manager',
                    node:'source_external_submit',
                    avid:av_edit_id,
                    url:url,
                    type:type
                };
                $.post(ajaxurl, post, function() {
                    html5avReset();
                });
            } else {
                alert('URL cannot be left blank!');
            }
            return false;
        })
    });
</script>